package com.westos.app.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.westos.app.bean.User;
import com.westos.app.dao.UserDAO;
import com.westos.app.service.UserService;

@Service("userService")
public class UserServiceImpl implements UserService {
	@Autowired
	private UserDAO dao;

	@Override
	public User loginByUserNameAndPassword(String username, String password) {
		User user = new User();
		user.setUsername(username);
		user.setPassword(password);
		return loginByUserNameAndPassword(user);
	}

	@Override
	public User loginByUserNameAndPassword(User user) {
		
		return dao.listUserByUserNameAndPassword(user.getUsername(), user.getPassword());

	}

	@Override
	public Boolean saveUser(User user) {
		//System.out.println(user+"save" );
		boolean flag = dao.saveUser(user);
		return flag;
	}

}
